home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_d
/
odbcall.zip
/
DEMO.ZIP
/
DEMO1.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1996-04-06
|
3KB
|
136 lines
unit Demo1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ODBCQry, ExtCtrls, Buttons, Odbcctrl, Grids,
TGQry, DataCtrl;
type
TForm1 = class(TForm)
Connection: TODBCCon;
DemoQuery: TODBCQuery;
CreateTable: TODBCQuery;
InsertValues: TODBCQuery;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
Edit4: TEdit;
Label5: TLabel;
SpeedButton8: TSpeedButton;
ODBCEdit1: TODBCEdit;
ODBCMemo1: TODBCMemo;
ODBCEdit2: TODBCEdit;
Label4: TLabel;
ODBCEdit3: TODBCEdit;
procedure Button1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
private
{ Private declarations }
Edited: Boolean;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ODBCAPI;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
RowNo: LongInt;
MyDate: Date_Struct;
begin
CreateTable.Execute;
MyDate.Year := 1995;
MyDate.Month := 7;
with InsertValues do
begin
Prepared := True;
for RowNo := 1 to 100 do
begin
Params[1].AsInteger := RowNo;
Params[2].AsString := 'Row' + IntToStr(RowNo);
MyDate.Day := RowNo mod 30 + 1;
Params[3].AsDate := MyDate;
Execute;
end;
Prepared := False;
end;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.First;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.Prior;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.Next;
end;
procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.Last;
end;
procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.Delete;
end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.Insert;
end;
procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.Update;
DemoQuery.ResetRows;
end;
procedure TForm1.SpeedButton8Click(Sender: TObject);
begin
if not DemoQuery.Active then DemoQuery.Active := True;
DemoQuery.RecordNo := StrToInt(Edit4.Text);
end;
end.